<?php

header('Access-Control-Allow-Origin:*');
ini_set('display_errors', 'On');
error_reporting(E_ALL);

if (isset($_REQUEST['m']))
    $_SERVER['PATH_INFO'] = '/' . str_replace('.', '/', $_REQUEST['m']);

// 检测PHP环境
if (version_compare(PHP_VERSION, '5.3.0', '<')) die('require PHP > 5.3.0 !');

define('APP_PATH', './Application/');//应用目录

define('IMAGE_PATH', './../data/image');//图片目录

define('THINK_PATH', realpath('Framework') . '/');// 框架目录

define('ROOT_PATH', dirname(THINK_PATH) . '/');//定义项目根目录

define('RUNTIME_PATH', ROOT_PATH . 'Runtime' . '/');//运行时的缓存文件

define('DS', DIRECTORY_SEPARATOR);

// 站点目录
define('SITE_DIR', dirname(__FILE__));


// 站点地址 TODO 防止在控制台中报错增加判断
define('SCRIPT_DIR', (isset($_SERVER['SCRIPT_NAME']) ? rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/\\') : ''));
define('SITE_URL', isset($_SERVER['HTTP_HOST']) ? 'http://' . $_SERVER['HTTP_HOST'] . SCRIPT_DIR : '');

//来源页面
define('HTTP_REFERER', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');

//文件上传根目录
// define('UPLOAD_PATH', APP_PATH.'Home/Public/upload/');
define('UPLOAD_PATH', './files/');

// 使用的协议
isset($_SERVER['HTTPS']) && 'on' === $_SERVER['HTTPS'] ? define('REQUEST_SCHEME', 'https') : define('REQUEST_SCHEME', 'http');

/*根据访问域名确定终端信息*/
$server_name = strtolower($_SERVER['SERVER_NAME']);
preg_match("/^(wap|touch|mc|l|app|m|www|client)[0-9]*(\.)*(dev\.)?/i", $server_name, $client_info);

// $client_id = $client_info[1];
// if($client_id!='client'){
// 	echo json_encode(array('code'=>'invalid request','msg'=>'无效请求'));exit;
// }
define("BIND_MODULE", "App");
/**
 * 状态配置：开发-develop、线上-online
 */
define('APP_STATUS', 'online');;
define('APP_DEBUG', true);
require THINK_PATH . 'ThinkPHP.php';//引入框架入口文件



